home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / serv.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  1KB  |  63 lines

  1. #include <exec/types.h>
  2. #include "intuition/intuition.h"
  3. #include "janus.h"
  4.  
  5. struct Library *JanusBase,*ATUtilitiesBase;
  6. struct ServiceData *sd=NULL;
  7. struct Window *c;
  8.  
  9. UBYTE *mem;
  10. LONG a,b,q,sig;
  11.  
  12. VOID main()
  13. {
  14.  JanusBase=OpenLibrary("janus.library",0L);
  15.  if(JanusBase!=NULL)
  16.   {
  17.    ATUtilitiesBase=OpenLibrary("at-utilities.library",0L);
  18.    if(ATUtilitiesBase!=NULL)
  19.     {
  20.      c=CreateStdWindow("AddService $74667466/$1001",
  21.                         75,75,450,100,
  22.                         CLOSEWINDOW|VANILLAKEY,WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG);
  23.      if(c!=NULL)
  24.       {
  25.        sig=AllocSignal(-1);
  26.        a=AddService(&sd,0x74667466,0x1001,16,MEMF_PARAMETER|MEM_BYTEACCESS,sig,ADDS_TOPC_ONLY);
  27.        if(a==JSERV_OK)
  28.         {
  29.          mem=sd->AmigaMemPtr;
  30.          printf("Amiga: $%08lx\n",mem);
  31.          printf("PC:    $%08lx\n",sd->PCMemPtr);
  32.  
  33.          q=1;
  34.          do
  35.           {
  36.            printf("PC: %08lx\n",sd->FirstPCCustomer);
  37.            printf("Call(%ld)\n",q);
  38.            mem[0]=q;
  39.            CallService(sd);
  40.            Delay(100);
  41.            q++; if(q>15) q=1;
  42.            b=GetMsg(c->UserPort);
  43.           } while(b==NULL);
  44.          ReplyMsg(b);
  45.  
  46.          printf("DeleteSerice()\n");
  47.          DeleteService(sd);
  48.         }
  49.        else
  50.         {
  51.          printf("Fehler: %ld\n",a);
  52.         }
  53.        FreeSignal(sig);
  54.        DeleteStdWindow(c);
  55.       }
  56.      CloseLibrary(ATUtilitiesBase);
  57.     }
  58.    CloseLibrary(JanusBase);
  59.   }
  60. }
  61.  
  62.  
  63.